/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view.Kasse;

import java.awt.Graphics;
import javax.swing.ImageIcon;
import model.Kategori;
import utility.ImageToolbox;

/**
 *
 * @author Jeppe
 */
public class KategoriIconPanel extends javax.swing.JPanel {

    private KategoriPanel kategoriPanel;
    private Kategori kategori;

    /**
     * Creates new form KategoriIconPanel
     */
    public KategoriIconPanel(KategoriPanel kategoriPanel, Kategori kategori) {
        initComponents();
        this.kategoriPanel = kategoriPanel;
        this.kategori = kategori;
        kategoriTitelLabel.setText(kategori.getKategoriNavn());
        iconLabel.setIcon(kategori.getKategoriIcon());

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        kategoriTitelLabel = new javax.swing.JLabel();
        iconLabel = new javax.swing.JLabel(){
            public void paint(Graphics g){
                ImageToolbox.drawImage(g, (ImageIcon)iconLabel.getIcon(), 0, 0, iconLabel.getWidth(), iconLabel.getHeight());
            }
        };
        kategoriKnap = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        setOpaque(false);
        setLayout(null);

        kategoriTitelLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        kategoriTitelLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        kategoriTitelLabel.setText("KategoriTitel");
        add(kategoriTitelLabel);
        kategoriTitelLabel.setBounds(0, 100, 130, 17);
        add(iconLabel);
        iconLabel.setBounds(0, 0, 130, 130);

        kategoriKnap.setContentAreaFilled(false);
        kategoriKnap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kategoriKnapActionPerformed(evt);
            }
        });
        add(kategoriKnap);
        kategoriKnap.setBounds(0, 0, 130, 130);
    }// </editor-fold>//GEN-END:initComponents

    private void kategoriKnapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kategoriKnapActionPerformed
        kategoriPanel.visVareListePanel(kategori);
    }//GEN-LAST:event_kategoriKnapActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel iconLabel;
    private javax.swing.JButton kategoriKnap;
    private javax.swing.JLabel kategoriTitelLabel;
    // End of variables declaration//GEN-END:variables
}
